Skip to content

London | 26-ITP-May | Zadri Abdule | Sprint 2 | Book - library - #520

Open
Zadri415 wants to merge 3 commits into
CodeYourFuture:mainfrom
Zadri415:sprint-2/book-library
Open

London | 26-ITP-May | Zadri Abdule | Sprint 2 | Book - library#520
Zadri415 wants to merge 3 commits into
CodeYourFuture:mainfrom
Zadri415:sprint-2/book-library

Conversation

@Zadri415

@Zadri415 Zadri415 commented Aug 6, 2026

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

  • index.html — fix form input types and wiring (changed submit button to call addBook()).
  • script.js — fixes for seeding, add-book handling, read state (use boolean), rendering, toggle read, and delete logic.

Questions

N/A

@Zadri415 Zadri415 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Data-Flows The name of the module. labels Aug 6, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check if any of this general feedback can help you further improve your code?
https://github.com/CodeYourFuture/Module-Data-Flows/blob/general-review-feedback/debugging/book-library/feedback.md

Doing so can help me speed up the review process. Thanks.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 7, 2026
@Zadri415 Zadri415 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 13, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good.

There are a few improvements you could still make.

Comment on lines +12 to +13
#toast {
position: fixed;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not prepare the CSS in style.css?

/>
<div class="col">
<label for="pages">Pages:</label>
<input type="number" class="form-control" id="pages" name="pages" min="1" required />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you find out why the browser is not enforcing the constraint min="1" required? Currently a user could submit page count suchas-123and12.345`.

@@ -1,103 +1,137 @@
let myLibrary = [];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we declare myLibrary in a way that prevents it from being accidentally reassigned?

// Preprocessing / validation:
// - reject empty or whitespace-only title/author (checked AFTER trim, not before)
// - reject non-numeric or non-positive page counts
if (!title || !author || !pagesRaw || !Number.isFinite(pages) || pages <= 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Do you know why checking !pageRaw is optional?

  • What type of number should a page count be?

Comment on lines +50 to +53
titleInput.value = "";
authorInput.value = "";
pagesInput.value = "";
checkInput.checked = false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the input elements are inside a <form>, we could also just reset the form with one function call.

Comment on lines +60 to +61
const table = document.getElementById("display");
const tbody = table.getElementsByTagName("tbody")[0];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: We could also use document.querySelector() to select the specific tbody element directly.

Comment on lines +100 to +101
const idx = myLibrary.indexOf(book);
if (idx === -1) return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also obtain the index of the current book from the second parameter of the function pass to forEach() on line 66.

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Data-Flows The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants